package com.yunlinker.asba.utils;

import org.json.JSONException;
import org.json.JSONObject;


/**
 * Created by Administrator on 2016/11/16 0016.
 */

public class JsonParseUtils {
    private  static JSONObject jsonObj = null;
    private static JSONObject getJSONObject(String json){
        try {
            jsonObj = new JSONObject(json);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        return jsonObj;
    }
    public  static Object getValue(String json, String key){
        if(getJSONObject(json)!=null){
            try {
                if(jsonObj.has(key))
                return jsonObj.get(key);
                else
                    return "";
            } catch (Exception e) {
                e.printStackTrace();
                return "";
            }
        }else{
            return "";
        }
    }
}
